<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>前端-接收后端数据渲染到页面</title>
</head>

<body>
    <ul id="list">
        <!-- <li data-id="10">
                    <p>华为</p>
                    <p>红色</p>
                    <p>价格：9999</p>
                </li> -->
    </ul>
</body>
<script src="myquery.js"></script>
<script>
    (function () {

        //获取接口数据做渲染
        ajax({
            type: 'get',
            url: 'api/getdata.php',
            success: str => {
                // console.log(str);
                //渲染
                let arr = JSON.parse(str);
                console.log(arr);
            }
        });
    })();
</script>

</html>